package com.qingcheng.controller.system;

import com.alibaba.dubbo.config.annotation.Reference;
import com.qingcheng.controller.UserDetailServiceImpl;
import com.qingcheng.entity.Result;
import com.qingcheng.pojo.business.Ad;
import com.qingcheng.pojo.system.Admin;
import com.qingcheng.service.system.AdminService;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.crypto.bcrypt.BCrypt;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/login")
public class LoginController {



    @Reference
    private AdminService adminService;


    @Reference
    private UserDetailServiceImpl userDetailService;



    @GetMapping("/name")
    public Map showName(){
        // TODO SecurityContextHolder.getContext() 获取上下文
        String name = SecurityContextHolder.getContext().getAuthentication().getName();

        Map map = new HashMap();
        map.put("name",name);
        return map;
    }

}
